<template>
    <div>
        <h1>房号添加</h1>
        <table class="table table-bordered">
            <tr>
                <td>房型名称</td>
                <td>
                    <input type="text" v-model="quinfo.name">
                </td>
            </tr>
            <tr>
                <td>房号</td>
                <td>
                    <input type="text" v-model="quinfo.hao">
                </td>
            </tr>
            <tr>
                <td>备注</td>
                <td>
                   <textarea v-model="quinfo.bie">

                   </textarea>
                </td>
            </tr>
            <tr>
                
                <td>
                    <input type="button" value="添加" @click="add">
                </td>
            </tr>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref,reactive,onMounted } from "vue";
import {useRoute,useRouter} from 'vue-router'
import axios from 'axios'
let router=useRouter();
let data:any=reactive({});
let quinfo=reactive({
  "name": "",
  "hao": 0,
  "bie": "",
  "state": 0,
})
const add=()=>{
    axios({
        url:'https://localhost:7098/api/FangHao/AddFHao',
        method:'post',
        data:quinfo
    })
    .then((res)=>{
        console.log(res);
        if(res.data>0){
            alert("添加成功!");
            router.push("/fangshow")
        }
        else{
            alert("添加失败!");
        }
    })
    .catch((err)=>{
        console.log(err);
    })
};

</script>

<style scoped>

</style>